package com.itheima.dao;

import com.itheima.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserDao {
    public User findByUsername(String username);

    @Select("select * from t_user")
    List<User> findAll();


    @Insert("insert into t_user(username,password) values(#{username},#{password})")
    @Options(useGeneratedKeys=true,keyProperty="id")
    void addUser(User user);


    @Delete("delete from t_user where id=#{id}")
    void deleteById(int id);


    @Select("select * from t_user where id=#{id}")
    User findById(int id);

    @Update("update t_user set username=#{username},password=#{password} where id=#{id}")
    void updateUser(User user);

}
